compress([],[]):-!.
compress(L1,L2):- compress(L1,L2,[],[]).
compress([],L2,_,L2):-!.
compress([X|T],L2,H,Acc):-
   X \= H,!,
   append(Acc,[X],K),
   compress(T,L2,X,K).
compress([X|T],L2,H,Acc):-
   X = H,
   compress(T,L2,X,Acc).
   